/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aplikasirawatinap;
import Service.Koneksi;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

/**
 *
 * @author Saptaji
 */
public class PembayaranForm extends javax.swing.JFrame {

    private Integer row;
    public Connection conn;
    PreparedStatement psmt;
    String select="Select *From pasien ORDER BY id_pasien ASC";
    private JTable jTabel = new JTable();
    private DefaultTableModel DfltTblMode;
    private TableColumn column;
    int hargaperhari;
    int sisa;
    private int ok;
    
    public PembayaranForm() {
        initComponents();
        tampilDataKeTabel();
        
    }
    
    private void tampilDataKeTabel() {
        jTabel = jTable1;
        tampilkandata(jTabel);
    }
    
    private void tampilDataKeTabelcari() {
        jTabel = jTable1;
        cari(jTabel);
    }
    private void tampilkandata(JTable jTabel) {
     try {
            Object[] field = {"No","id_pasien","tgl_masuk","nm_depan","nm_belakang","gender","tgl_lahir","nm_ayah","agama","alamat","pekerjaan","umur","gol_darah","status","nm_ruangan","kel_ruangan","lokasi","nm_dokter","diagnosa","DP"};
            DfltTblMode = new DefaultTableModel(null, field);
            jTabel.setModel(DfltTblMode);
           
            conn=Koneksi.getConnection();
            
            PreparedStatement statement = conn.prepareStatement(select);
            ResultSet rs =statement.executeQuery(select);
                  
            int no = 0;
            while (rs.next()) {
                no++;
                String kolom1 = String.valueOf(no).toString();
                String kolom2 = rs.getString("id_pasien");
                String kolom3 = rs.getString("tanggal_masuk");
                String kolom4 = rs.getString("first_name");
                String kolom5 = rs.getString("last_name");
                String kolom6 = rs.getString("gender");
                String kolom7 = rs.getString("tgl_lahir");
                String kolom8 = rs.getString("nm_ayah_kandung");
                String kolom9 = rs.getString("agama");
                String kolom10 = rs.getString("alamat");
                String kolom11 = rs.getString("Pekerjaan");
                String kolom12 = rs.getString("umur");
                String kolom13 = rs.getString("gol_darah");
                String kolom14 = rs.getString("status");
                String kolom15 = rs.getString("nm_ruangan");
                String kolom16 = rs.getString("kel_ruangan");
                String kolom17 = rs.getString("lokasi");
                String kolom18 = rs.getString("nm_dokter");
                String kolom19 = rs.getString("diagnosa");
                String kolom20 = rs.getString("DP");
                String[] data = {kolom1, kolom2, kolom3, kolom4, kolom5, kolom6, kolom7, kolom8, kolom9, kolom10, kolom11, kolom12, kolom13, kolom14, kolom15, kolom16, kolom17, kolom18, kolom19, kolom20};
                DfltTblMode.addRow(data);
            }
            
            jTabel.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
            column = jTabel.getColumnModel().getColumn(0);
            column.setPreferredWidth(40);
            column = jTabel.getColumnModel().getColumn(1);
            column.setPreferredWidth(100);
            column = jTabel.getColumnModel().getColumn(2);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(3);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(4);
            column.setPreferredWidth(150); 
            column = jTabel.getColumnModel().getColumn(5);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(6);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(7);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(8);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(9);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(10);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(11);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(12);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(13);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(14);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(15);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(16);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(17);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(18);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(19);
            column.setPreferredWidth(150);
          }
          catch (SQLException e) {
              JOptionPane.showMessageDialog(this, "Koneksi gagal: " +e);
          }  
   }
   private void klikTabel(JTable jTabel)
   {
        jTabel.setRowSelectionAllowed(true);
        row = jTabel.getSelectedRow();
        String kolom1 = jTabel.getValueAt(row,0).toString();
        String kolom2 = jTabel.getValueAt(row,1).toString();
        String kolom3 = jTabel.getValueAt(row,2).toString();
        String kolom4 = jTabel.getValueAt(row,3).toString();
        String kolom5 = jTabel.getValueAt(row,4).toString();
        String kolom6 = jTabel.getValueAt(row,5).toString();
        String kolom7 = jTabel.getValueAt(row,6).toString();
        String kolom8 = jTabel.getValueAt(row,7).toString();
        String kolom9 = jTabel.getValueAt(row,8).toString();
        String kolom10 = jTabel.getValueAt(row,9).toString();
        String kolom11 = jTabel.getValueAt(row,10).toString();
        String kolom12 = jTabel.getValueAt(row,11).toString();
        String kolom13 = jTabel.getValueAt(row,12).toString();
        String kolom14 = jTabel.getValueAt(row,13).toString();
        String kolom15 = jTabel.getValueAt(row,14).toString();
        String kolom16 = jTabel.getValueAt(row,15).toString();
        String kolom17 = jTabel.getValueAt(row,16).toString();
        String kolom18 = jTabel.getValueAt(row,17).toString();
        String kolom19 = jTabel.getValueAt(row,18).toString();
        String kolom20 = jTabel.getValueAt(row,19).toString();
        
        String[] tglmasuk = kolom3.split(" ");
        tx_idpem.setText(kolom2);
        com_daym.removeAllItems();
        com_daym.addItem(tglmasuk[0]);
        com_monthm.removeAllItems();
        com_monthm.addItem(tglmasuk[1]);
        com_yearm.removeAllItems();
        com_yearm.addItem(tglmasuk[2]);
        tx_diagnosa.setText(kolom19);
        tx_fname.setText(kolom4);
        tx_lname.setText(kolom5);
        tx_ayah.setText(kolom8);
        com_kelas.setSelectedItem(kolom16);
        tx_dp.setText(kolom20);
        
        //perhitungan jumlah hari & jumlah biaya keseluruhan
        String kelas = String.valueOf(com_kelas.getSelectedItem());
        String select1 = String.valueOf(com_monthm.getSelectedItem());
        String select2 = String.valueOf(com_monthk.getSelectedItem());
        String select3 = String.valueOf(com_yearm.getSelectedItem());
        String select4 = String.valueOf(com_yeark.getSelectedItem());
        String selectday = (String) com_dayk.getSelectedItem();
        int tahunm = Integer.parseInt(select3);
        int tahunk = Integer.parseInt(select4);
        int iharimasuk = Integer.parseInt(tglmasuk[0]);
        int iharikeluar = Integer.parseInt(selectday);
        String dp = tx_dp.getText();
        String[] sdepe = dp.split(" ");
        int idp = Integer.parseInt(sdepe[1]);
        int tothari;
        int totpembayaran;
        
        //initial hargaperhari
        
        
        
        if(kelas.equals("Kelas-1"))
        {
            hargaperhari = 500000;
            tx_bperhari.setText(Integer.toString(hargaperhari));
            String total = tx_bperhari.getText();
            double harga = Double.parseDouble(total);
            DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
            DecimalFormatSymbols dfs = new DecimalFormatSymbols();
            dfs.setCurrencySymbol("");
            dfs.setMonetaryDecimalSeparator(',');
            dfs.setGroupingSeparator('.');
            df.setDecimalFormatSymbols(dfs);
            String hsl = "Rp. " + df.format(harga);
            tx_bperhari.setText(hsl);
        }
        else if(kelas.equals("Kelas-2"))
        {
            hargaperhari = 1000000;
            tx_bperhari.setText(Integer.toString(hargaperhari));
            String total = tx_bperhari.getText();
            double harga = Double.parseDouble(total);
            DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
            DecimalFormatSymbols dfs = new DecimalFormatSymbols();
            dfs.setCurrencySymbol("");
            dfs.setMonetaryDecimalSeparator(',');
            dfs.setGroupingSeparator('.');
            df.setDecimalFormatSymbols(dfs);
            String hsl = "Rp. " + df.format(harga);
            tx_bperhari.setText(hsl);
        }
        else if(kelas.equals("VIP"))
        {
            hargaperhari = 1500000;
            tx_bperhari.setText(Integer.toString(hargaperhari));
            String total = tx_bperhari.getText();
            double harga = Double.parseDouble(total);
            DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
            DecimalFormatSymbols dfs = new DecimalFormatSymbols();
            dfs.setCurrencySymbol("");
            dfs.setMonetaryDecimalSeparator(',');
            dfs.setGroupingSeparator('.');
            df.setDecimalFormatSymbols(dfs);
            String hsl = "Rp. " + df.format(harga);
            tx_bperhari.setText(hsl);
        }
        
        if(iharimasuk<iharikeluar) 
        {
            if(select1.equals(select2))
            {
                tothari = iharikeluar-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Januari")&&select2.equals("Februari"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Februari")&&select2.equals("Maret"))
            {
                tothari = (iharikeluar+29)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Maret")&&select2.equals("April"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("April")&&select2.equals("Mei"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Mei")&&select2.equals("Juni"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juni")&&select2.equals("Juli"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juli")&&select2.equals("Agustus"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Agustus")&&select2.equals("September"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("September")&&select2.equals("Oktober"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
               totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Oktober")&&select2.equals("November"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("November")&&select2.equals("Desember"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Desember")&&select2.equals("Januari"))
            {
                if(tahunm<tahunk)
                {
                    tothari = (iharikeluar+30)-iharimasuk;
                    totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
                }
            }
            
        }
        else if(iharimasuk==iharikeluar)
        {
            if(select1.equals(select2))
            {
                tothari = iharikeluar-iharimasuk;
                totpembayaran = (hargaperhari);
                sisa = (hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Januari")&&select2.equals("Februari"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Februari")&&select2.equals("Maret"))
            {
                tothari = (iharikeluar+29)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Maret")&&select2.equals("April"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("April")&&select2.equals("Mei"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Mei")&&select2.equals("Juni"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juni")&&select2.equals("Juli"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juli")&&select2.equals("Agustus"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Agustus")&&select2.equals("September"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("September")&&select2.equals("Oktober"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
               totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Oktober")&&select2.equals("November"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("November")&&select2.equals("Desember"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
               totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Desember")&&select2.equals("Januari"))
            {
                if(tahunm<tahunk)
                {
                    tothari = (iharikeluar+30)-iharimasuk;
                    totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
                }
            }
        }
        else if(iharimasuk>iharikeluar)
        {
            
            if(select1.equals("Januari")&&select2.equals("Februari"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Februari")&&select2.equals("Maret"))
            {
                tothari = (iharikeluar+29)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Maret")&&select2.equals("April"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("April")&&select2.equals("Mei"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
               totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Mei")&&select2.equals("Juni"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
               totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juni")&&select2.equals("Juli"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Juli")&&select2.equals("Agustus"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Agustus")&&select2.equals("September"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("September")&&select2.equals("Oktober"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Oktober")&&select2.equals("November"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("November")&&select2.equals("Desember"))
            {
                tothari = (iharikeluar+30)-iharimasuk;
                totpembayaran = (tothari*hargaperhari);
                sisa = (tothari*hargaperhari)-idp;
                tx_jumhar.setText(Integer.toString(tothari));
                tx_total.setText(Integer.toString(totpembayaran));
                tx_sisa.setText(Integer.toString(sisa));
                String total = tx_total.getText();
                String sSisa = tx_sisa.getText();
                double harga = Double.parseDouble(total);
                double harga2 = Double.parseDouble(sSisa);
                DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                dfs.setCurrencySymbol("");
                dfs.setMonetaryDecimalSeparator(',');
                dfs.setGroupingSeparator('.');
                df.setDecimalFormatSymbols(dfs);
                String hsl = "Rp. " + df.format(harga);
                String hsl2 = "Rp. " + df.format(harga2);
                tx_total.setText(hsl); 
                tx_sisa.setText(hsl2);
            }
            else if(select1.equals("Desember")&&select2.equals("Januari"))
            {
                if(tahunm<tahunk)
                {
                    tothari = (iharikeluar+30)-iharimasuk;
                    totpembayaran = (tothari*hargaperhari);
                    sisa = (tothari*hargaperhari)-idp;
                    tx_jumhar.setText(Integer.toString(tothari));
                    tx_total.setText(Integer.toString(totpembayaran));
                    tx_sisa.setText(Integer.toString(sisa));
                    String total = tx_total.getText();
                    String sSisa = tx_sisa.getText();
                    double harga = Double.parseDouble(total);
                    double harga2 = Double.parseDouble(sSisa);
                    DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance();
                    DecimalFormatSymbols dfs = new DecimalFormatSymbols();
                    dfs.setCurrencySymbol("");
                    dfs.setMonetaryDecimalSeparator(',');
                    dfs.setGroupingSeparator('.');
                    df.setDecimalFormatSymbols(dfs);
                    String hsl = "Rp. " + df.format(harga);
                    String hsl2 = "Rp. " + df.format(harga2);
                    tx_total.setText(hsl); 
                    tx_sisa.setText(hsl2);
                }
            }
        }
   }
   private void saveLaporan()
   {
      
      try
      {
          String idpem=tx_idpem.getText();
          conn = Koneksi.getConnection();
          Statement st=conn.createStatement();
          String sql2="Select id_pembayaran FROM pembayaran Where id_pembayaran='" + idpem + "'";
          ResultSet rs=st.executeQuery(sql2);
          if(rs.next()){JOptionPane.showMessageDialog(null,"id_pembayaran "+idpem+" Sudah Membayar", "ERROR", JOptionPane.PLAIN_MESSAGE);}
          else{
            ok = JOptionPane.showConfirmDialog(null, "Anda yakin akan menyimpan data pembayaran ini?", "Konfirmasi", JOptionPane.OK_CANCEL_OPTION);
            if (ok == 0){
                String sql = "Insert into pembayaran "+"values(?,?,?,?,?,?)";
                psmt = conn.prepareStatement(sql);
                psmt.setString(1,tx_idpem.getText());
                psmt.setString(2,(String)com_dayk.getSelectedItem()+" "+com_monthk.getSelectedItem()+" "+com_yeark.getSelectedItem());
                psmt.setString(3,tx_jumhar.getText());
                psmt.setString(4,tx_bperhari.getText());
                psmt.setString(5,tx_total.getText());
                psmt.setString(6,tx_sisa.getText());
                psmt.executeUpdate();
                JOptionPane.showMessageDialog(null, "data pembayaran pasien telah ditambah");
                psmt.close();
            }
          }
      }
      catch (SQLException ex) 
      {
            JOptionPane.showMessageDialog(this, "Data gagal disimpan! : " +ex);
      }   
   }
   public void cari(JTable jTabel){
    try {
            Object[] field = {"No","id_pasien","tgl_masuk","nm_depan","nm_belakang","gender","tgl_lahir","nm_ayah","agama","alamat","pekerjaan","umur","gol_darah","status","nm_ruangan","kel_ruangan","lokasi","nm_dokter","diagnosa","DP"};
            DfltTblMode = new DefaultTableModel(null, field);
            jTabel.setModel(DfltTblMode);
           
            conn=Koneksi.getConnection();
            
            String search ="Select * from pasien where tanggal_masuk like '%" + tx_search.getText() + "%'" +
                         "or first_name like '%" + tx_search.getText() + "%'";
            PreparedStatement statement = conn.prepareStatement(search);
            ResultSet rs =statement.executeQuery(search);
                  
            int no = 0;
            while (rs.next()) {
                no++;
                String kolom1 = String.valueOf(no).toString();
                String kolom2 = rs.getString("id_pasien");
                String kolom3 = rs.getString("tanggal_masuk");
                String kolom4 = rs.getString("first_name");
                String kolom5 = rs.getString("last_name");
                String kolom6 = rs.getString("gender");
                String kolom7 = rs.getString("tgl_lahir");
                String kolom8 = rs.getString("nm_ayah_kandung");
                String kolom9 = rs.getString("agama");
                String kolom10 = rs.getString("alamat");
                String kolom11 = rs.getString("Pekerjaan");
                String kolom12 = rs.getString("umur");
                String kolom13 = rs.getString("gol_darah");
                String kolom14 = rs.getString("status");
                String kolom15 = rs.getString("nm_ruangan");
                String kolom16 = rs.getString("kel_ruangan");
                String kolom17 = rs.getString("lokasi");
                String kolom18 = rs.getString("nm_dokter");
                String kolom19 = rs.getString("diagnosa");
                String kolom20 = rs.getString("DP");
                String[] data = {kolom1, kolom2, kolom3, kolom4, kolom5, kolom6, kolom7, kolom8, kolom9, kolom10, kolom11, kolom12, kolom13, kolom14, kolom15, kolom16, kolom17, kolom18, kolom19, kolom20};
                DfltTblMode.addRow(data);
            }
            
            jTabel.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
            column = jTabel.getColumnModel().getColumn(0);
            column.setPreferredWidth(40);
            column = jTabel.getColumnModel().getColumn(1);
            column.setPreferredWidth(100);
            column = jTabel.getColumnModel().getColumn(2);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(3);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(4);
            column.setPreferredWidth(150); 
            column = jTabel.getColumnModel().getColumn(5);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(6);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(7);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(8);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(9);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(10);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(11);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(12);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(13);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(14);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(15);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(16);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(17);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(18);
            column.setPreferredWidth(150);
            column = jTabel.getColumnModel().getColumn(19);
            column.setPreferredWidth(150);
          }
          catch (SQLException e) {
              JOptionPane.showMessageDialog(this, "Koneksi gagal: " +e);
          }  
   }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        b_save = new javax.swing.JButton();
        b_clear = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        tx_idpem = new javax.swing.JTextField();
        tx_fname = new javax.swing.JTextField();
        tx_lname = new javax.swing.JTextField();
        tx_ayah = new javax.swing.JTextField();
        com_daym = new javax.swing.JComboBox();
        com_monthm = new javax.swing.JComboBox();
        com_yearm = new javax.swing.JComboBox();
        com_dayk = new javax.swing.JComboBox();
        com_monthk = new javax.swing.JComboBox();
        com_yeark = new javax.swing.JComboBox();
        tx_jumhar = new javax.swing.JTextField();
        tx_total = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        tx_search = new javax.swing.JTextField();
        b_search = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        tx_dp = new javax.swing.JTextField();
        l_kelas = new javax.swing.JLabel();
        com_kelas = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        tx_bperhari = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        tx_diagnosa = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        tx_sisa = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setText("FORM PEMBAYARAN");

        jLabel2.setText("ID PEMBAYARAN");

        jLabel3.setText("Tanggal Masuk");

        jLabel4.setText("Tanggal Keluar");

        jLabel5.setText("Nama Depan");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jTable1MousePressed(evt);
            }
        });
        jScrollPane1.setViewportView(jTable1);

        b_save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/bayar.png"))); // NOI18N
        b_save.setText("BAYAR");
        b_save.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b_saveActionPerformed(evt);
            }
        });

        b_clear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/clear.png"))); // NOI18N
        b_clear.setText("BERSIHKAN");

        jLabel7.setText("Nama Belakang");

        jLabel8.setText("Nama Ayah");

        jLabel9.setText("Jumlah Hari");

        jLabel10.setText("Total Pembayaran");

        tx_idpem.setEnabled(false);

        tx_fname.setEnabled(false);

        tx_lname.setEnabled(false);

        tx_ayah.setEnabled(false);

        com_daym.setEnabled(false);

        com_monthm.setEnabled(false);
        com_monthm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                com_monthmActionPerformed(evt);
            }
        });

        com_yearm.setEnabled(false);

        com_dayk.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        com_dayk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                com_daykActionPerformed(evt);
            }
        });

        com_monthk.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" }));
        com_monthk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                com_monthkActionPerformed(evt);
            }
        });

        com_yeark.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029", "2030", "2031", "2032", "2034", "2035" }));

        tx_jumhar.setEnabled(false);

        tx_total.setEnabled(false);

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/pay.png"))); // NOI18N

        jLabel11.setText("Search berdasarkan tgl.masuk/nama depan");

        b_search.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/search.png"))); // NOI18N
        b_search.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b_searchActionPerformed(evt);
            }
        });

        jLabel15.setText("DP");

        tx_dp.setEnabled(false);

        l_kelas.setText("Kelas");

        com_kelas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Kelas-1", "Kelas-2", "VIP" }));
        com_kelas.setEnabled(false);

        jLabel12.setText("Biaya/Hari");

        tx_bperhari.setEnabled(false);

        jLabel13.setText("Diagnosa");

        tx_diagnosa.setEditable(false);
        tx_diagnosa.setEnabled(false);

        jLabel14.setText("Sisa Pembayaran");

        tx_sisa.setEditable(false);
        tx_sisa.setEnabled(false);

        jMenuBar1.setPreferredSize(new java.awt.Dimension(56, 30));

        jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/back.png"))); // NOI18N
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jMenu1MousePressed(evt);
            }
        });
        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(52, 52, 52)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(68, 68, 68)
                                .addComponent(jLabel1))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel2)
                                        .addGap(18, 18, 18)
                                        .addComponent(tx_idpem, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel5)
                                            .addComponent(jLabel7)
                                            .addComponent(jLabel8)
                                            .addComponent(l_kelas))
                                        .addGap(26, 26, 26)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(tx_bperhari)
                                            .addComponent(tx_fname, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                                            .addComponent(tx_lname, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                                            .addComponent(tx_ayah, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                                            .addComponent(com_kelas, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                                .addGap(73, 73, 73)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel9)
                                    .addComponent(jLabel15)
                                    .addComponent(jLabel10))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(com_daym, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(com_monthm, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(com_yearm, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(com_dayk, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(com_monthk, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(com_yeark, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(tx_diagnosa, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tx_jumhar, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tx_dp, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tx_total, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 657, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel12))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(tx_search, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(b_search))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(68, 68, 68)
                                        .addComponent(jLabel14)
                                        .addGap(18, 18, 18)
                                        .addComponent(tx_sisa, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(b_save)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(b_clear)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel6)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(tx_idpem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tx_fname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tx_lname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(com_daym, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(com_monthm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(com_yearm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(15, 15, 15)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(com_dayk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(com_monthk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(com_yeark, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(tx_diagnosa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(tx_ayah, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(tx_jumhar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(l_kelas)
                            .addComponent(com_kelas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tx_dp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(tx_bperhari, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(tx_total, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(tx_sisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(tx_search, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(b_save)
                            .addComponent(b_clear)))
                    .addComponent(b_search))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        new UserForm().setVisible(true);
        dispose();
    }//GEN-LAST:event_formWindowClosing

    private void b_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_saveActionPerformed
        // TODO add your handling code here:
        saveLaporan();
    }//GEN-LAST:event_b_saveActionPerformed

    private void com_daykActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_com_daykActionPerformed
        // TODO add your handling code here:
        //totalPembayaran();
        klikTabel(jTable1);
    }//GEN-LAST:event_com_daykActionPerformed

    private void jTable1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MousePressed
        // TODO add your handling code here:
        klikTabel(jTable1);
    }//GEN-LAST:event_jTable1MousePressed

    private void jMenu1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MousePressed
        // TODO add your handling code here:
        new UserForm().setVisible(true);
        dispose();

    }//GEN-LAST:event_jMenu1MousePressed

    private void com_monthkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_com_monthkActionPerformed
        // TODO add your handling code here:
        klikTabel(jTable1);
    }//GEN-LAST:event_com_monthkActionPerformed

    private void com_monthmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_com_monthmActionPerformed
        // TODO add your handling code here:
        klikTabel(jTable1);
    }//GEN-LAST:event_com_monthmActionPerformed

    private void b_searchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_searchActionPerformed
        // TODO add your handling code here:
        tampilDataKeTabelcari();
    }//GEN-LAST:event_b_searchActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PembayaranForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PembayaranForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PembayaranForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PembayaranForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PembayaranForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton b_clear;
    private javax.swing.JButton b_save;
    private javax.swing.JButton b_search;
    private javax.swing.JComboBox com_dayk;
    private javax.swing.JComboBox com_daym;
    private javax.swing.JComboBox com_kelas;
    private javax.swing.JComboBox com_monthk;
    private javax.swing.JComboBox com_monthm;
    private javax.swing.JComboBox com_yeark;
    private javax.swing.JComboBox com_yearm;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel l_kelas;
    private javax.swing.JTextField tx_ayah;
    private javax.swing.JTextField tx_bperhari;
    private javax.swing.JTextField tx_diagnosa;
    private javax.swing.JTextField tx_dp;
    private javax.swing.JTextField tx_fname;
    private javax.swing.JTextField tx_idpem;
    private javax.swing.JTextField tx_jumhar;
    private javax.swing.JTextField tx_lname;
    private javax.swing.JTextField tx_search;
    private javax.swing.JTextField tx_sisa;
    private javax.swing.JTextField tx_total;
    // End of variables declaration//GEN-END:variables
}
